
setRemUnit();

window.addEventListener('resize', setRemUnit);

function setRemUnit() {
    var docEl = document.documentElement;
    var ratio = 7.2; //rem系数 设计稿720px,分为7.2份,每份100px 也就说1rem=100px;
    var viewWidth = docEl.getBoundingClientRect().width || window.innerWidth;
    
    docEl.style.fontSize = viewWidth / ratio + 'px';

    //console.log(viewWidth,docEl.style.fontSize);//对于414宽度来说，font-size = 414/7.2=57.5px，和postcss-px2rem的rootValue吻合
}
